<script setup>
import { useExampleStore } from '@/stores/example';

const exampleStore = useExampleStore();
const type = exampleStore.type;
watch(
	() => exampleStore.triggerAction,
	(newValue) => {
		if (newValue) {
			// 执行你希望的操作
			if (type === 'xx') {
				performAction();
			}
			// 重置状态，防止重复执行
			exampleStore.triggerAction = false;
		}
	}
);

function performAction() {
	console.log('Action triggered in Component B');
}
</script>
